﻿using System;
using System.Web.Mvc;

namespace JinianNet.Web.MVC
{
    public class WebFormViewEngine : ViewEngine
    {
        public WebFormViewEngine(string[] viewLocation, string[] masterLocation, string[] areaMasterLocation, string[] areaViewLocation, string[] partialViewLocation, string[] areaPartialViewLocation) :
            base(viewLocation, masterLocation, areaMasterLocation, areaViewLocation, partialViewLocation, areaPartialViewLocation)
        {
        }

        public WebFormViewEngine(string[] viewLocation)
            : this(viewLocation, viewLocation, viewLocation, viewLocation, viewLocation, viewLocation)
        {

        }

        public WebFormViewEngine() :
            this(new string[]{
                "~/View/{0}.aspx",
                "~/View/{1}/{0}.aspx",
                "~/View/{2}/{0}.aspx",
                "~/View/{2}/{1}/{0}.aspx"
            })
        {
        }


        protected override IView CreatePartialView(ControllerContext controllerContext, string partialPath)
        {
            return new WebFormView(controllerContext, partialPath);
        }

        protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath)
        {
            return new WebFormView(controllerContext, viewPath, masterPath);
        }


    }
}
